CC	=gcc -D__KERNEL__
CPP	=$(CC) -E

all: zImage

zImage: boot/bootsect.bin boot/setup.bin
	rm -f zImage
	bximage -mode=create -fd=1.44M -q zImage
	dd if=boot/bootsect.bin of=zImage bs=512 count=1 conv=notrunc status=none
	dd if=boot/setup.bin of=zImage bs=512 count=4 seek=1 conv=notrunc status=none

boot/%.bin: boot/%.S
	$(CPP) -traditional $< -o boot/$*.s
	nasm -o $@ boot/$*.s

run: zImage
	bochs -qf bochsrc

clean:
	rm -rf boot/*.bin boot/*.s zImage
